package com.ftg.learn.chapter04;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * 学习一下调整为数组
 *
 * @author lijiaxin
 * @version 1.0
 * @date 2023/5/20 13:26
 */

public class LearnArray {


    public static void choose(int[] arr2){
//            int[] arr2=new int[]{2,5,1};
        for(int j=0;j<arr2.length-1;j++){
            //计数器
            int maxval=Integer.MIN_VALUE;
            int index=0;
            for(int i=0;i<arr2.length-j;i++){
                if(maxval<arr2[i]){
                    maxval=arr2[i];
                    index=i;
                }
            }
            arr2[index]=arr2[arr2.length-1-j];
            arr2[arr2.length-1-j]=maxval;
        }
        System.out.println(Arrays.toString(arr2));

    }



    public static void main(String[] args) {

//        [类型][] [标识符] [=] [new] [类型][长度];

//        char c1=new char[3];
//        int[] int2={1,2,3,4,5,6};
//        System.out.println(Arrays.toString(int2));
//        for (int i = 0; i < int2.length; i++) {
//            int2[i]=int2[i]+int2[i-1];
//        }
//        System.out.println(Arrays.toString(int2));
//
//        for (int i = int2.length-1; i > 0; i--) {
//            int2[i]=int2[i]+int2[i-1];
//        }
//        System.out.println(Arrays.toString(int2));

//        choose(arr2);


    //加法
//        int c=9;
//        int b=13;
//        b=b+c;
//        c=b-c;
//        b=b-c;
//        System.out.println(c);
//        System.out.println(b);

        //减法


    }
}
